package com.fzh.controller.front;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fzh.pojo.entity.Comment;
import com.fzh.pojo.entity.Message;
import com.fzh.service.CommentService;
import com.fzh.service.MessageService;

@Controller
public class CommentController {
	
//	@Autowired
//	private CommentService commentService;
	
	@Autowired
	private MessageService messageService;
	
	
//	@RequestMapping("/insertComment")
//	@ResponseBody
//    public String insertComment(Comment comment){
//		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
//		String format = dateFormat.format(new Date());
//		comment.setCmtime(format);
//		commentService.insertComment(comment);
//    	return "success";
//    }
	/**
	 * 新增评价信息
	 */
	@RequestMapping("/insertMessage")
	@ResponseBody
    public String insertMessage(Message message){
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
		String format = dateFormat.format(new Date());
		message.setCreateTime(format);
		messageService.insertMessage(message);
    	return "success";
    }
}
